package cn.com.lei.du.controller;

import cn.com.lei.du.entity.User;
import cn.com.lei.du.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * @description 根据用户ID 查询用户
     */
    @PostMapping("/findById/{id}")
    public User findById(@PathVariable("id") String id){
        log.info("用户ID = {}",id);
        return userService.findById(id);
    }

    /**
     * @description 添加用户
     */
    @PostMapping("/addUser")
    public User addUser(@RequestBody User user){
        log.info("添加的用户,{}",user);
        return userService.addUser(user);
    }


}
